from rest_framework import serializers
from .models import NavigationGroup, NavigationLink

class NavigationLinkSerializer(serializers.ModelSerializer):
    """导航链接序列化器"""
    class Meta:
        model = NavigationLink
        fields = ['id', 'group', 'name', 'url', 'icon', 'description', 'order', 'is_active']

class NavigationGroupSerializer(serializers.ModelSerializer):
    """导航分组序列化器"""
    links = NavigationLinkSerializer(many=True, read_only=True)

    class Meta:
        model = NavigationGroup
        fields = ['id', 'title', 'order', 'links']
